package controller;

import java.awt.event.ItemListener;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import model.ProductModel;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.Products;

public class ManageProducts extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
								throws ServletException, IOException{
		List<ProductModel> products = new ArrayList<ProductModel>();
		Products productDTO = new Products();
		products = productDTO.ListProducts();
		request.setAttribute("products", products);
		request.getRequestDispatcher("products.jsp").forward(request, response);
//		RequestDispatcher dispatcher =
//			request.getRequestDispatcher
//			("products.jsp");
//			dispatcher.forward(request, response);
	}
}
